//package com.hydra.base.filter;
//
//import com.hydra.base.utils.IpUtil;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.stereotype.Component;
//
//import javax.servlet.*;
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.io.IOException;
//
///**
// * 控制器的过滤器
// * @Author 陈煜敏
// * @Date 2022/9/14 10:48
// */
//@Slf4j
//@Component
//public class AccessCorsFilter implements Filter {
//
//    @Override
//    public void init(FilterConfig filterConfig) {
//        log.info("创建AccessCors过滤器");
//    }
//
//    @Override
//    public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws IOException, ServletException {
//
//        HttpServletResponse response = (HttpServletResponse)resp;
//        response.setHeader("Access-Control-Allow-Origin", "*");
//        response.setHeader("Access-Control-Allow-Methods", "*");
//        response.setHeader("Access-Control-Max-Age", "3600");
//        response.setHeader("Access-Control-Allow-Headers", "*");
//
//        chain.doFilter(req, resp);
//    }
//
//    @Override
//    public void destroy() {
//        log.info("销毁AccessCors过滤器");
//    }
//}
